package com.example.manager.mapper;

import com.example.manager.domain.Product;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ProductMapper {

    @Select("select * from product")
    public List<Product> selectProducts();

    @Insert("insert into product (product_name, enable) VALUES (#{product_name}, #{enable})")
    public void insertProduct(Product product);

    @Update("update product set product_name=#{product_name} where product_id=#{product_id}")
    public void updateProduct(Product product);

    @Update("update product set enable=#{enable} where product_id=#{product_id}")
    public void updateProductEnable(Short enable, Integer product_id);
}
